<script>
export default {
  name: 'GlobalFilterListener',
  beforeDestroy () {
    this.unsubscribeEventBus()
  },
  mounted () {
    this.subscribeEventBus()
  },
  methods: {
    eventBusHandler (e) {
      console.log(e)
    },
    unsubscribeEventBus () {
      this.$EventBus.$off('type-changed', this.eventBusHandler)
      this.$EventBus.$off('type-value-changed', this.eventBusHandler)
    },
    subscribeEventBus () {
      this.$EventBus.$on('type-changed', this.eventBusHandler)
      this.$EventBus.$on('type-value-changed', this.eventBusHandler)
    },
  },
}
</script>
